package com.xlh.param.user;

import com.xlh.util.InputValidator;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;

/**
 * 修改用户信息参数
 * <p>
 * Created by lx on 2019/2/21 0021.
 */
@Data
public class UpdateUserInfoParam {

    @ApiModelProperty(value = "姓名")
    @NotBlank(message = "请输入姓名")
    @Length(max = 10, message = "姓名不能超过10个字符")
    private String name;

    @ApiModelProperty(value = "手机号")
    @Length(max = 11, message = "请输入正确的手机号")
    private String telephoneNumber;

    @ApiModelProperty(value = "邮箱")
    @Length(max = 50, message = "邮箱不能超过50个字符")
    private String email;

    @ApiModelProperty(value = "是否显示邮箱 true：是 false：不显示")
    private Boolean showEmail = false;

    @ApiModelProperty(value = "性别名")
    private String sexName;

    @ApiModelProperty(value = "头像")
    @NotBlank(message = "头像不能为空")
    private String icon;

    public String getName() {
        return name == null ? null : InputValidator.regSpecialChar(name).replaceAll(" ", "");
    }

    public String getTelephoneNumber() {
        return telephoneNumber == null ? null : InputValidator.regSpecialChar(telephoneNumber);
    }

    public String getEmail() {
        return email == null ? null : InputValidator.regSpecialChar(email).replaceAll(" ", "");
    }

    public String getSexName() {
        return sexName == null ? null : InputValidator.regSpecialChar(sexName).replaceAll(" ", "");
    }

}
